package com.newland.mesdk.demo.interfaceimpl;

import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

import com.newland.mtype.ModuleType;
import com.newland.mtype.module.common.emv.EmvTransInfo;
import com.newland.mtype.module.common.emv.EmvWorkingMode;
import com.newland.mtype.module.common.emv.QPBOCModule;
import com.newland.mesdk.demo.moduleinterface.QPBOCInterface;
import com.newland.mesdk.demo.util.ModuleBase;

/**
 * Created by HJP QPBOC模块接口实现
 */
public class QPBOCInterfaceImpl extends ModuleBase implements QPBOCInterface {
	private QPBOCModule qpbocModule;

	public QPBOCInterfaceImpl() {
		qpbocModule = (QPBOCModule) factory.getModule(ModuleType.COMMON_QPBOC);
	}

	@Override
	public void setWorkingMode(EmvWorkingMode workingMode) {
		qpbocModule.setWorkingMode(workingMode);
	}

	//开启一个消费的QPBOC流程
	@Override
	public EmvTransInfo startQPBOC(BigDecimal amount, long timeout, TimeUnit timeunit) {
		EmvTransInfo emvTransInfo = qpbocModule.startQPBOC(amount, timeout, timeunit);
		return emvTransInfo;
	}

	//开启一个标准的QPBOC流程
	@Override
	public EmvTransInfo startQPBOC(int processingCode, int innerProcessingCode, BigDecimal amount, long timeout, TimeUnit timeunit) {
		EmvTransInfo emvTransInfo = qpbocModule.startQPBOC(processingCode, innerProcessingCode, amount, timeout, timeunit);
		return emvTransInfo;
	}

}
